package com.bj58.mis.apm.client.core.util;

import java.util.Map;

/**
 * @author: zhangfx
 * @create: 2018-06-12 18:03
 **/
public class MapUtil {
    public static String mapToPrintString(Map map, String prefixTab){
        StringBuilder sb = new StringBuilder();
        sb.append("{").append("\n");
        for(Object key : map.keySet()){
            Object val = map.get(key);
            sb.append(prefixTab+"\t").append(key).append(" = ");
            if(val instanceof Map){
                sb.append(mapToPrintString((Map) val, prefixTab+"\t"));
            }else{
                sb.append(val).append("\n");
            }
        }
        sb.append(prefixTab).append("}").append("\n");
        return sb.toString();
    }
}
